import {createStore, combineReducers} from "redux";
import { persistStore, persistReducer } from 'redux-persist'
import storage from 'redux-persist/lib/storage'
import CollapsedReducer from "./reducers/CollapsedReducer";
import LoadingReducer from "./reducers/LoadingReducer"


// 合并所有状态、状态处理
const reducer = combineReducers({
    CollapsedReducer,
    LoadingReducer
})

const persistConfig = {
    key: 'hhlNews',
    storage,
    blacklist: ['LoadingReducer'] // 黑名单，不持久化
}

// 将 reducer 进行持久化处理
const persistedReducer = persistReducer(persistConfig, reducer)

const store = createStore(persistedReducer)
const persistor = persistStore(store)

export {
    store,
    persistor
}